<html>
<head><meta charset="utf-8"><title>Fault tolerant serde deserializer · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Fault.20tolerant.20serde.20deserializer.html">Fault tolerant serde deserializer</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="204655595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Fault%20tolerant%20serde%20deserializer/near/204655595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Fault.20tolerant.20serde.20deserializer.html#204655595">(Jul 22 2020 at 11:54)</a>:</h4>
<p>Hello! I am trying to implement a fault tolerant custom deserializer with serde. By fault tolerant I mean a deserializer that can "skip" invalid items in collections (array for my specific use case), record the error and continue. I am fine with syntax error being fatal and not being able to continue/recover. But when its basically a data type error (wrong type, wrong field name, etc) I want to be able to skip the entry and record the error.  </p>
<p>I can't seem to come out with an approach that does not depend on the actual data format. The best thing i've got is using <code>serde_json::value::RawValue</code>: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=6f9ac5fa69b3a84f7c11c4e35c3152bc">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=6f9ac5fa69b3a84f7c11c4e35c3152bc</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>